#!/bin/bash
#
# pre-receive hook for Commit Check
#

COMPANY_EMAIL="mycorp.org"

readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m $(dirname $0))

function check_single_commit() {
    COMMIT_CHECK_STATUS=0
    # 
    # Put here any logic you want for your commit
    #
    # COMMIT_MESSAGE contains commit message
    # COMMIT_AUTHOR contains commit author (without email)
    # 
    # Set COMMIT_CHECK_STATUS to non zero to indicate an error
}

function check_all_commits() {
    REVISIONS=$(git rev-list $OLD_REVISION..$NEW_REVISION)
    IFS='\n' read -ra LIST_OF_REVISIONS <<< "$REVISIONS"

    echo $IFS
    echo $REVISIONS
}

# Get custom commit message format
while read OLD_REVISION NEW_REVISION REFNAME; do
    echo $OLD_REVISION $NEW_REVISION $REFNAME
    check_all_commits
done

exit 0